import 'package:flutter/material.dart';

class ShoppingCartPage extends StatefulWidget {
  const ShoppingCartPage({super.key});

  @override
  State<StatefulWidget> createState() => _ShoppingCartPage();

}

class _ShoppingCartPage extends State<ShoppingCartPage> with SingleTickerProviderStateMixin {
  List tabs = ["热点","新闻", "历史"];
  late TabController _tabController;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _tabController = TabController(length: tabs.length, vsync: this);
  }


  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: const Text("测试"),
        bottom: TabBar(
            controller: _tabController,
            tabs: tabs.map((v)=> Text(v)).toList()),
      ),
      body: TabBarView(
        controller: _tabController,
          children: [
            ListView(children: const [ListTile(title: Text("热点1"),),ListTile(title: Text("热点1"),)],),
            ListView(children: const [ListTile(title: Text("新闻1"),),ListTile(title: Text("新闻1"),)],),
            ListView(children: const [ListTile(title: Text("历史1"),),ListTile(title: Text("历史1"),)],),
        ]
      ),
    );
  }

  @override
  void dispose() {
    // TODO: implement dispose
    _tabController.dispose();
    super.dispose();
  }
}
